package chixing.day11.clone_demo;

import chixing.day11.clone_demo.Book;

public class DataTransfer {
    public static void main(String[] args) {
        int a = 1;
        int b = 2;
        fun1(a, b);
        System.out.println("a = " + a);
        System.out.println("b = " + b);

        Book book = new Book("数据结构",99.9f);
        fun2(book);
        System.out.println(book.getBookName());
        System.out.println(book.getBookPrice());
    }

    //int x = a  基本数据类型的赋值是将值复制一份给其他变量,
    public static void fun1(int a, int b) {
        a = 10;
        b = 20;
    }

    //Book xx=book 引用数据类型的赋值，传递的是 堆内存地址（指向同一块 堆内存）
    public static void fun2(Book xx) {//Book xx=book
        xx.setBookName("java程序设计");
        xx.setBookPrice(89.9f);
    }
}
